package com.test.rabforspringboot.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class DirectConfig {

    /**
     * 创建一个直联队列
     * @return
     */
    @Bean
    public Queue directQueue(){
        return new Queue("directQueue");
    }
    @Bean
    public Queue directQueue1(){
        return new Queue("directQueue1");
    }

    /**
     * 创建一个直联交换机
     * @return
     */
    @Bean
    public DirectExchange directExchange(){
        return new DirectExchange("directExchange");
    }

    @Bean
    public Binding bindingDirect(){
        //sdfdsfsf
        return BindingBuilder.bind(directQueue()).to(directExchange()).with("direct");
    }

    @Bean
    public Binding bindingDirect1(){
        return BindingBuilder.bind(directQueue1()).to(directExchange()).with("direct1");
    }









}
